/* ----------------------------------------------------------------------- *
 *   
 *   SF Video Stream Buffer
 *   API file 
 *   
 *   author : Ramon
 *   
 *   date   : 2016-11-10
 *
 * ----------------------------------------------------------------------- */

#ifndef _SFONE_STREAM_BUFFER_H_
#define _SFONE_STREAM_BUFFER_H_

#ifdef WIN32
#include "targetver.h"
#include <afxwin.h>
#else
	#include <sys/time.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct __SFStream_Data_Info_ 
{
	unsigned int	nFrameType;
	unsigned int	nKeyFrame;
	unsigned int	nFrameNum;
	char*			pFrameData;
	unsigned int	nFrameSize;
	struct timeval  timestamp;

#ifdef __cplusplus
	__SFStream_Data_Info_()
	{
		nFrameType	= 0;
		nKeyFrame	= 0;
		nFrameNum	= 0;
		pFrameData	= 0;
		nFrameSize	= 0;
		timestamp.tv_sec = 0;
	}
#endif
} SFStream_Data_Info;

typedef struct __SFStream_Init_Info_ 
{
	unsigned int nBufferSize;
	unsigned int nIndexCount;
	unsigned int nFrameInterval;
	unsigned int nNeedLocker;
#ifdef __cplusplus
	__SFStream_Init_Info_()
	{
		nBufferSize		= 0;
		nIndexCount		= 0;
		nFrameInterval	= 0;
		nNeedLocker		= 0;
	}
#endif
} SFStream_Init_Info;

#define _MEDIA_TYPE_UNKNOW_  0
#define _MEDIA_TYPE_VIDEO_   1
#define _MEDIA_TYPE_AUDIO_   2

int SFStreamInit(unsigned int streamNo,SFStream_Init_Info aSFStream_Init_Info);
int SFStreamClose(unsigned int streamNo);
int SFStreamWrite(unsigned int streamNo, SFStream_Data_Info DataInfo);
int SFStreamGetLastIFrame(unsigned int streamNo, int* pReadCurPos, unsigned int startTime);
int SFStreamRead(unsigned int streamNo, SFStream_Data_Info* DataInfo, int* pReadCurPos);

#ifdef __cplusplus
}
#endif  /* end of __cplusplus */  


#endif // _SFONE_STREAM_BUFFER_H_
